<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>温湿度</title>
		<link rel="stylesheet" type="text/css" href="../css/header.css">
		<link rel="stylesheet" type="text/css" href="../css/easylink.css">
		<script type="text/javascript" src="../script/jquery-2.1.3.js"></script>
		<script type="text/javascript" src="../script/av-0.5.0.min.js"></script>
		<script type="text/javascript" src="../script/config.js"></script>
		<script type="text/javascript" src="../script/api.js"></script>
		<script type="text/javascript" src="../script/jquery.md5.js"></script>
		<script type="text/javascript" src="../script/mico-user-0.1.js"></script>
		<script type="text/javascript" src="../script/mico-bind-0.1.js"></script>
		<script type="text/javascript" src="../script/mico_app_easylink.js"></script>
		<script type="text/javascript" src="../script/mico_app_user.js"></script>
		<script type="text/javascript" src="../script/msgdic-zh.js"></script>
		<style>
			body {
				font-family: "黑体";
				font-size: 13px;
				background-color: #EBEBEB;
				font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
				color: #000;
				margin: 0;
				padding: 0;
			}
			.left {
				display: block;
			}
			#mdnsdevliid {
				list-style-type: none;
			}
		</style>
	</head>
	<body>
		<div class="wrapper">
			<!--顶部标题-->
			<header id="header" class="header">
				<div class="head">
					<a class="left" onclick="checkpage()">返回</a>
					<span class="center" id="titleName">设备联网</span>
				</div>
			</header>
			<div class="devcontent">
				<div class="content">
					<div class="serachText">
						<img src="../image/smallcircle.svg"/>&nbsp; <span>请将设备进行配网</span>
					</div>
					<div class="phoned">
						<input type="text" placeholder="WiFi名称" id="wifi_ssid" readonly/>
					</div>
					<div class="pswed">
						<input type="text" placeholder="WiFi密码" id="wifi_psw"/>
					</div>
					<div class="subbutton" onclick="startmicobind()" id="sousuoid">
						<span><a class="easysearchcls" href="#">搜索 </a></span>
					</div>
				</div>
				<div class="mdnsdevlistcls">
					<div class="mdnsdjhsb">
						<img src="../image/smallcircle.svg"/>&nbsp; <span>待绑定设备</span>
					</div>
					<ul id="mdnsdevliid"></ul>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		var searchtag = 0;
		// 页面初始化
		apiready = function() {
			// 	获取wifi的SSID
			getssid();
			// 	开始跟新mDNS列表
			getmDNSlist();
			if (api.systemType != 'ios') {
				api.addEventListener({
					name : "keyback"
				}, function(ret, err) {
					checkpage();
				});
			} else {
				$(".header").css("padding-top", "30px");
				$(".left").css("top", "32px");
			}
		};
		// 停止发包或者页面跳转
		function checkpage() {
			if (1 == searchtag) {
				api.confirm({
					title : "停止发包",
					msg : "是否停止发送配网数据",
					buttons : [OK_BTN, CANCEL_BTN]
				}, function(ret, err) {
					if (ret.buttonIndex == 1) {
						searchtag = 0;
						hidPro();
						stopmicobind();
					}
				});
			} else {
				stopMdns();
				hidPro();
				window.location.href = "./devlist.html";
			}
		};
	</script>
</html>